package it.eng.area118.mdocommon.android.rest;

import it.eng.area118.mdocommon.android.log.BasicLogger;

import java.io.IOException;

import org.springframework.http.HttpInputMessage;
import org.springframework.http.HttpOutputMessage;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.http.converter.HttpMessageNotWritableException;
import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;

public class Converter extends MappingJacksonHttpMessageConverter {

	private final static String TAG = Converter.class.getName();

	@Override
	protected void writeInternal(Object o, HttpOutputMessage outputMessage)
			throws IOException, HttpMessageNotWritableException {
		// XXX Auto-generated method stub
		super.writeInternal(o, outputMessage);
		BasicLogger.writeLog(TAG, "writeInternal: " + o + " - " + outputMessage);

	}

	@Override
	protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage)
			throws IOException, HttpMessageNotReadableException {
		// XXX Auto-generated method stub
		Object o = super.readInternal(clazz, inputMessage);
		BasicLogger.writeLog(TAG, "readInternal: " + clazz);
		BasicLogger.writeLog(TAG, "readInternal: " + o + " - " + inputMessage);
		return o;
	}

}
